<?php
if(!defined('InEmpireCMS'))
{
	exit();
}
$ptypeId=65;
$mid=10;
?>
<?php
//print_r($public_r[newsurl]);
$url="<a href=../../../>首页</a>&nbsp;>&nbsp;<a href=../cp/>控制面板</a>";
require(ECMS_PATH.'e/data/template/cp_1.php');
?>
<input type="hidden" id="newsurl" value="<?=$public_r['newsurl']?>" />
<script src="../data/html/setday.js"></script>
<script src="<?=$public_r[newsurl]?>skin/jquery.uploadify-v2.1.4/swfobject.js"></script>
<script src="<?=$public_r[newsurl]?>skin/jquery.uploadify-v2.1.4/jquery.uploadify.v2.1.4.min.js"></script>
<link href="<?=$public_r[newsurl]?>skin/jquery.uploadify-v2.1.4/uploadify.css" rel="stylesheet" type="text/css" />

<div class="dmain_conent">
<div class="pageindex">
	<a class="tips " href="<?=$public_r[newsurl]?>e/member/photo/?uid=<?=$user_id?>"><?php if($is_my){ ?>我<?php }else{ ?>TA<?php }?>的专辑</a>
	<a class="tips " href="<?=$public_r[newsurl]?>e/member/photo/all.php?uid=<?=$user_id?>"><?php if($is_my){ ?>我<?php }else{ ?>TA<?php }?>的全部照片</a>
	<a class="tips active" href="<?=$public_r[newsurl]?>e/member/photo/upload.php">上传照片</a>
</div>
	<div class='dmini-content'>
	<style>
.list-p dl{clear3:both;height2:200px;border-bottom:1px dashed #eee;padding:5px;width:200px;float:left;border:1px solid #eee;margin:5px;background:#fafafa;}
.list-p dl dt{text-align:center;padding:5px;padding-top:10px;}
.list-p dl dd{clear:left;}
.list-p dl dd div{height:22px;}
.title{color:#000;font-weight:bold;}
.spn_title{padding:2px;}
.list-p input{height:16px;background:#eee;border:1px solid #666;}
.mini-content{padding:20px;}
	</style>
	<div class='mini-content'>
		选择照片专辑：
		<select class='album_id'>
			<option value="0">默认专辑</option>
			<?php foreach($albumArr as $ky=>$vl){?>
			<option value='<?=$vl['id']?>'><?=$vl['title']?></option>
			<?php }?>
		</select>
<div>
	<a href="javascript:addNewAlbum();">新建专辑</a>	
	<input id="file_upload" name="file_upload" type="file" />
</div>
		<div class="list-pv">
			<script>
				$(document).ready(function() {
					$('#file_upload').uploadify({
					'uploader'       : '<?=$public_r[newsurl]?>skin/jquery.uploadify-v2.1.4/uploadify.swf',
					'script'         : '<?=$public_r[newsurl]?>e/jat/album_pic_upload.php',
					'cancelImg'      : '<?=$public_r[newsurl]?>skin/jquery.uploadify-v2.1.4/cancel.png',
					'folder'         : '<?=$public_r[newsurl]?>skin/upload',
					'multi'          : true,
					'auto'           : false,
					"scriptData"	 : {"sid":"<?=$sid?>"},
					'onComplete'  : function(event, ID, fileObj, response, data) {						
						show_pics(getObject(response));						
				},
				"":function(){
				
				},
				"onAllComplete"	:function(){					
					$(".list-p").append("<div class='clear'></div>");
					$(".ok_div").show();
				}
				  });
			});
		function show_pics(o){
			var string="";
				string=["<dl><dt><img height='120' src='"+o.url+"' /></dt>",
						"<dd><div><span class='spn_title'>名称：</span><input value='"+o.title+"' fid='"+o.id+"' class='file-title'/></div></dd>",
					"</dl>"].join("");			
			var ls=$(".list-p").html();
			$(".list-p").html(ls+string);			
		}
			function addNewAlbum(){
				popUpLoadUrl("建立专辑",'add_album',{"act":"add_album"},function(){
					$(".add_album").click(function(){
						var title=$(".album_title").val();
						var content=$(".content").val();
						var addr=$(".addr").val();
						var addr=$(".addr").val();
						var permission=$(".permission").val();
						if(title.length<3){
							alert('专辑名称不能少3个字符！');
							return false;
						}
							$.ajax({type:"POST",	dataType:"json",data:{"dataFromType":"ajax","act":"add_pic_ablum","title":title,"content":content,"addr":addr,"permission":permission},
									url:($("#newsurl").val())+"e/jat/",
							success:function(r){
								if(r.flag==1){
									$(".album_id>option[selected]").removeAttr("selected");
									$(".album_id").append("<option value="+(r.album_id)+" selected='selected'>"+(r.title)+"</option>");
									return false;
								}else if(r.msg){
									alert(r.msg);	
								}else{
									alert("系统错误，请与管理员联系");
								}
									
						}});

					});
				
				});
			}
			function edit_pic(){
				var jo=$(".file-title");
				var o=[];
				var d=[];				
				for(var i=0;i<jo.length;i++){
					o[i]=jo.eq(i).val();
					d[i]=jo.eq(i).attr("fid");
				}
				alert(o.length);
				$.ajax({type:"POST",dataType:"json",data:{"dataFromType":"ajax","act":"edit_upoaded_pic","t":o,"i":d},
						url:($("#newsurl").val())+"e/jat/",
				success:function(r){
					if(r.flag==1){
						window.location.href="./";
						return false;
					}else if(r.msg){
						alert(r.msg);	
					}else{
						alert("系统错误，请与管理员联系");
					}
						
			}});
			}
			</script>
			<a href="javascript:$('#file_upload').uploadifyUpload();">Upload Files</a>
		</div>
	<div class="list-p">

		</div>
	<div class="ok_div" style="display:none;"><input type="button" value="编辑完提交" onclick="edit_pic()" class="ok_submit"/></div>
	</div>

</div>

</div>
<?php
require(ECMS_PATH.'e/data/template/cp_2.php');
?>